//
//  MXHomeNavCell.m
//  HNBaseProject
//
//  Created by xujie on 2024/6/1.
//

#import "MXHomeNavCell.h"

@interface MXHomeNavCell ()
@property (nonatomic,strong) UIImageView *icon;
@property (nonatomic,strong) UILabel     *bottomLab;
@end

@implementation MXHomeNavCell
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    self.icon = [[UIImageView alloc] init];
    [self.contentView addSubview:self.icon];
    
    self.bottomLab = [[UILabel alloc] init];
    self.bottomLab.textColor = [UIColor colorWithHexString:@"#000000"];
    self.bottomLab.font = PFRFontMedium(11);
    [self.contentView addSubview:self.bottomLab];
    
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.mas_equalTo(28);
        make.top.offset(0);
        make.centerX.mas_equalTo(self.contentView);
    }];
    
    [self.bottomLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView);
        make.top.mas_equalTo(self.icon.mas_bottom).offset(8);
        make.height.mas_equalTo(10);
    }];
}

- (void)reloadCellWithIconName:(NSString *)iconName title:(NSString *)title {
    self.icon.image = [UIImage imageNamed:iconName];
    self.bottomLab.text = title;
}

@end
